﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ReservaEv extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index(){
		$this->load->model('reserva_evento_modelo');

		$data["reservaEv"]=$this->reserva_evento_modelo->ListarReservaEventoPorAprobar();
		
		$this->load->view('admin/admin_ev_reserva',$data);
	}
	
	public function aprobados(){
		$this->load->model('reserva_evento_modelo');
		$data["reservaEv"]=$this->reserva_evento_modelo->ListarReservaEventosAprobados();
		$this->load->view('admin/lista_ev_aprobados',$data);
	}
	
	public function prueba(){
		$this->load->view('admin/prueba.php');
	}

	public function reservar(){
			$this->load->view('admin/form_ev_reserva.php');
			}

	public function reservaEvento(){
		
		$nombre_Cliente=$this->input->post("nombre_Cliente");
		$RIF_Cliente=$this->input->post("RIF_Cliente");	
		$correo_Cliente=$this->input->post("correo_Cliente");
		$tlf_Cliente=$this->input->post("tlf_Cliente");	
		
		$fecha_IN=$this->input->post("fecha_IN");
		if($fecha_IN=="")$fecha_IN="0000-00-00";

		$fecha_OUT=$this->input->post("fecha_OUT");
		if($fecha_OUT=="")$fecha_OUT="0000-00-00";
		
		$desc=$this->input->post("desc");

		$id=$RIF_Cliente;
		
		$this->load->model('reserva_evento_modelo');
		$r=$this->reserva_evento_modelo->InsertarReservaEvento($id,$nombre_Cliente, $RIF_Cliente, $correo_Cliente, $tlf_Cliente, $fecha_IN, $fecha_OUT, $desc, 0, 0);
		$this->load->view('inicio.php');

	}
	
	public function aprobar($id){
		$this->load->model('reserva_evento_modelo');
		$this->reserva_evento_modelo->AprobarReservaEvento($id);
		$data["reservaEv"]=$this->reserva_evento_modelo->ListarReservaEventoPorAprobar();
		$this->load->view('admin/admin_ev_reserva.php',$data);
	}
	
	public function eliminar($id){
		$this->load->model('reserva_evento_modelo');
		$this->reserva_evento_modelo->EliminarReservaEvento($id);
		$data["reservaEv"]=$this->reserva_evento_modelo->ListarReservaEventoPorAprobar();
		$this->load->view('admin/admin_ev_reserva.php',$data);
	}


}

